package com.cxy.instarsystem.web;

import com.cxy.instarsystem.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@Controller
public class NewsController {

    @Autowired
    private NewsService newsService;

    @GetMapping("news/{id}")
    public String getnews(@PathVariable Long id, Model model){
        model.addAttribute("news", newsService.getNews(id));
        return "news";
    }

}
